package klog

import (
	"gitee.com/mkwchecking/sr-core/log/ilog"
	klog "github.com/go-kratos/kratos/v2/log"
)

var _ klog.Logger = (*KLog)(nil)

func New(logger ilog.Logger) klog.Logger {
	return &KLog{logger: logger}
}

type KLog struct {
	logger ilog.Logger
}

// Log implements log.Logger.
func (k *KLog) Log(level klog.Level, keyvals ...interface{}) error {
	switch level {
	case klog.LevelDebug:
		k.logger.Debug("", keyvals...)
	case klog.LevelInfo:
		k.logger.Info("", keyvals...)
	case klog.LevelWarn:
		k.logger.Warn("", keyvals...)
	case klog.LevelError:
		k.logger.Error("", keyvals...)
	default:
		k.logger.Debug("", keyvals...)
	}
	return nil
}
